import { Http } from "@/utils/request";
import { Toast } from "@/utils/toast";
import { delayTask } from "@/utils/timer";

const baseUrl = "/my";

export const data_api = <T = any>(
  data: { includes: string },
  showError = true
) => {
  return Http.get<T>(`${baseUrl}/data`, data).catch((error: Error) => {
    showError && delayTask(60, () => Toast.show(error.message));
    return Promise.reject(error);
  });
};
